package com.chinasoft.set01.map;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Demo04 {
    public static void main(String[] args) {

        Map<String,String> map = new HashMap<>();
        //put(K key, V value)
        map.put("k1","v1");
        map.put("k2","v2");
        map.put("k3","v3");
        map.put("k4","v4");
        map.put("k5","v5");
        // mehtod1(map);
        Set<Map.Entry<String, String>> entrySet = map.entrySet();
        for(Map.Entry<String, String> me:entrySet){
            String key = me.getKey();
            String value = me.getValue();
            System.out.println(key+","+value);
        }


    }

    private static void mehtod1(Map<String, String> map) {
        //获取所有键的集合
        Set<String> keySet = map.keySet();
        for (String k:keySet) {
            String v = map.get(k);
            System.out.println(k+" ^^ " + v);
        }
    }


}